from django.shortcuts import render
from django.http import HttpResponse
from content import service


# Create your views here.

def index(request):
    word = service.get_word_for_index()
    pic = service.get_pic_for_index()
    result_map = {
        'word1': word[0],
        'word2': word[1],
        'pic1': pic[0],
        'pic2': pic[1]
    }
    return render(request, 'index.html', result_map)


def blog(request):
    blog_list = service.get_article_for_blog()
    result_map = {
        'list': blog_list
    }
    return render(request, 'blog.html', result_map)


def test(request):
    return HttpResponse(u'启动成功')
